home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / source_code / tydhtml / dyn.exe / Chap06 / dyn6_3.txt < prev    next >
Encoding:
Text File  |  1997-10-02  |  702 b   |  27 lines

  1. <HTML>
  2.  
  3. <HEAD>
  4.  
  5. <TITLE>Mouse Movements</TITLE>
  6.  
  7. </HEAD>
  8.  
  9. <SCRIPT language="javascript">
  10.  
  11. document.captureEvents(Event.MOUSEMOVE);
  12.  
  13. function HandleEvent (e) {
  14.  
  15.   message = "Event = " + e.type + ". "; //identify the event type
  16.  
  17.   message += "x,y position = " + e.layerX + ", " + e.layerY; //where click was
  18.  
  19.   document.displayForm.coordinates.value = message; //display the information
  20.  
  21.   return true;
  22.  
  23. }
  24.  
  25. document.onmousemove = HandleEvent;
  26.  
  27. </SCRIPT>
  28.  
  29. <BODY>
  30.  
  31. <H1>Here's a page</H1>
  32.  
  33. <P>Howdy</P>
  34.  
  35. <H1>Here's a page</H1>
  36.  
  37. <P>Howdy</P>
  38.  
  39. <H1>Here's a page</H1>
  40.  
  41. <P>Howdy</P>
  42.  
  43. <FORM name="displayForm">
  44.  
  45. <INPUT name="coordinates" type=text size="45">
  46.  
  47. </FORM>
  48.  
  49. </BODY>
  50.  
  51. </HTML>
  52.  
  53.